﻿<UserControl x:Class="Showroom.WPF.Views.Layouts"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ViewModels="clr-namespace:Showroom.ViewModels" xmlns:my="clr-namespace:SStuff.FlowControls;assembly=SStuff.FlowControls" xmlns:LayoutAlgorithms="clr-namespace:SStuff.LayoutAlgorithms;assembly=SStuff.LayoutAlgorithms" mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800">
    <UserControl.Resources>
        <DataTemplate x:Key="itemTemplate">
            <Grid>
                <Ellipse Width="80" Height="80" Stroke="Black"  Fill="White"/>
                <TextBlock Text="{Binding}" HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.DataContext>
            <ViewModels:VirtualizationSampleData/>
        </Grid.DataContext>
    <TabControl Background="{x:Null}">
        <TabItem Header="2D - Circular">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <my:FlowItemsControl2D Name="flowItemsControl2D1"  ItemsSource="{Binding Path=Items}" ItemTemplate="{StaticResource itemTemplate}" >
                        <my:FlowItemsControl2D.LayoutAlgorithm>
                            <LayoutAlgorithms:Circular2DLayout />
                        </my:FlowItemsControl2D.LayoutAlgorithm>
                        <my:FlowItemsControl2D.ItemContainerStyle>
                            <Style TargetType="my:FlowItem2D" >
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="my:FlowItem2D" >
                                            <Grid>
                                                <Line Stretch="Uniform" Width="50" IsHitTestVisible="False"  VerticalAlignment="Center" HorizontalAlignment="Stretch" Stroke="Black" Height="1" X2="50" Y1="0.5" Y2="0.5" RenderTransformOrigin="0.5,0.5">
                                                    <Line.RenderTransform>
                                                        <TransformGroup>
                                                            <TranslateTransform X="-60" />
                                                            <RotateTransform CenterX="0.5" CenterY="0.5" Angle="{Binding Path=(LayoutAlgorithms:Circular2DLayout.ItemRotation), RelativeSource={RelativeSource TemplatedParent} }" />
                                                        </TransformGroup>
                                                    </Line.RenderTransform>
                                                </Line>
                                                <ContentPresenter />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </my:FlowItemsControl2D.ItemContainerStyle>
                    </my:FlowItemsControl2D>

                    <Border Grid.Column="1">
                        <StackPanel>
                            <TextBlock Text="MaxItemCount:" />
                            <Slider Minimum="1" Maximum="50" Value="{Binding Path=LayoutAlgorithm.MaximumItemCount, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                            <TextBlock Text="StartAngle:" />
                            <Slider Minimum="-180" Maximum="180" Value="{Binding Path=LayoutAlgorithm.StartAngle, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                            <TextBlock Text="EndAngle:" />
                            <Slider Minimum="-180" Maximum="180" Value="{Binding Path=LayoutAlgorithm.EndAngle, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                            <TextBlock Text="FadeInAngle:" />
                            <Slider Minimum="0" Maximum="180" Value="{Binding Path=LayoutAlgorithm.FadeInAngle, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                            <TextBlock Text="FadeOutAngle:" />
                            <Slider Minimum="0" Maximum="180" Value="{Binding Path=LayoutAlgorithm.FadeOutAngle, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                            <TextBlock Text="HorizontalScale:" />
                            <Slider Minimum="0" Maximum="3" Value="{Binding Path=LayoutAlgorithm.HorizontalScale, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                            <TextBlock Text="VerticalScale:" />
                            <Slider Minimum="0" Maximum="3" Value="{Binding Path=LayoutAlgorithm.VerticalScale, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                            <TextBlock Text="CenterX:" />
                            <Slider Minimum="0" Maximum="1" Value="{Binding Path=LayoutAlgorithm.CenterX, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                            <TextBlock Text="CenterY:" />
                            <Slider Minimum="0" Maximum="1" Value="{Binding Path=LayoutAlgorithm.CenterY, Mode=TwoWay, ElementName=flowItemsControl2D1}" />
                        </StackPanel>
                    </Border>
                </Grid>
            </TabItem>
    </TabControl>

    </Grid>
</UserControl>
